Skip to content

Spapadop/plt 859 stabilize devenv startup script so generated devenvs boot#24

Merged
spapa013 merged 8 commits intonauticalab:develop/spapadopfrom
spapa013:spapadop/plt-859-stabilize-devenv-startup-script-so-generated-devenvs-boot
Mar 6, 2026
Merged

Spapadop/plt 859 stabilize devenv startup script so generated devenvs boot#24
spapa013 merged 8 commits intonauticalab:develop/spapadopfrom
spapa013:spapadop/plt-859-stabilize-devenv-startup-script-so-generated-devenvs-boot

Conversation

@spapa013
Copy link
Collaborator

@spapa013 spapa013 commented Mar 5, 2026

Summary

This PR completes the startup reliability remediation bundle for generated DevEnv pods so bootstrap consistently reaches sshd and usable SSH access, including stale persistent-storage recovery paths.

What Changed

User/group provisioning reliability

  • Replaced incorrect numeric UID/GID checks with getent passwd / getent group.
  • Kept provisioning idempotent for create/rename/reuse cases.
  • Ensured new user creation explicitly binds target primary group (useradd -g ...).

Homebrew persistent storage remediation

  • Added pre-install repair for persisted Linuxbrew path:
    • ensure /home/linuxbrew and /home/linuxbrew/.linuxbrew exist
    • recursive ownership fix to dev user
    • scoped top-level mode fix

VS Code startup hardening

  • Ensure .vscode-server exists before ownership repair to avoid set -e abort on missing directory.

Python path + config validation consistency

  • Removed conflicting filepath validator on pythonBinPath.
  • Added explicit validation: non-empty pythonBinPath must be absolute.
  • Added test coverage for BaseConfig and DevEnvConfig absolute/relative behavior.

Python bootstrap reliability

  • Added on-demand /opt/venv bootstrap when default pythonBinPath (/opt/venv/bin) is used but interpreter is missing:
    • install python3-venv
    • create venv at /opt/venv
    • fix ownership to dev user

Persistent home stale-ownership remediation

  • Added recursive ownership repair of /home/<user> before user environment setup.
  • Prevents failures like .bashrc: Permission denied when stale files persist across runs.

Shell robustness

  • Added consistent quoting for user/group/path arguments in key ownership/admin commands.

Why

Validation exposed multiple independent startup failure modes that could prevent pods from becoming usable before sshd launch. This PR addresses the coordinated set required for reliable generated DevEnv bootstrap on Kubernetes, including stale persistent-storage scenarios.

Validation Performed

  • Unit tests:
    • go test ./internal/config
  • Kubernetes validation with generated manifests:
    • DevEnv pod reaches Running and launches sshd
    • SSH access confirmed
    • Missing /opt/venv/bin/python3 path case resolved via venv bootstrap
    • Missing .vscode-server no longer causes startup failure
    • Linuxbrew stale-ownership scenario handled
    • Stale home-file ownership scenario validated via seeded stale .bashrc and restart path (no permission-denied setup failure)

Notes

This issue tracks the full tactical startup remediation set needed for generated DevEnv bootstrap reliability and aligns with the completion criteria in the issue description.

spapa013 added 7 commits March 4, 2026 23:54
… UID/GID lookups and conditional rename/create logic for the dev account.
…tall to prevent breakage from stale UID/GID ownership
…tion and remove conflicting filepath tag so valid absolute paths pass consistently
… shell quoting for user/group and path arguments
… setup to prevent stale-dotfile permission failures (e.g. .bashrc)
@spapa013 spapa013 requested a review from eywalker March 5, 2026 02:21
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@spapa013 spapa013 changed the base branch from main to develop/spapadop March 6, 2026 19:27
@spapa013 spapa013 merged commit 4ca67d0 into nauticalab:develop/spapadop Mar 6, 2026
2 checks passed
@spapa013 spapa013 deleted the spapadop/plt-859-stabilize-devenv-startup-script-so-generated-devenvs-boot branch March 6, 2026 21:22
@spapa013 spapa013 mentioned this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant